package com.zzt.community.service;

import com.zzt.community.dao.AlphaDao;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

/**
 * Classname: AlphaService
 * Package: com.zzt.community.service
 * Description:
 *
 * @Author:zzt
 * @Create: 2024/3/1-10:17
 * Version:
 */
@Service
//@Scope("prototype")只实例化一次还是多次
public class AlphaService {

    @Autowired
    private AlphaDao alphaDao;

    public  AlphaService(){
        System.out.println("实例化AlphaService");
    }
    @PostConstruct  //让初始化方法在构造器之后调用
    public void init(){
        System.out.println("初始化AlphaService");
    }
    @PreDestroy     //销毁之前调用
    public void destroy(){
        System.out.println("销毁AlphaService");
    }

    public String find(){
        return alphaDao.select();
    }
}
